﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using UnityEngine.SceneManagement;
using UnityEditor.SceneManagement;

public class EasyEditor
{
    [MenuItem("Custom/GoToSetup")]
    public static void GotoSetup()
    {
        EditorSceneManager.OpenScene(Application.dataPath + "/Scenes/Setup.unity");
    }

    [MenuItem("Custom/GoToUIEditor")]
    public static void GoToUIEditor()
    {
        EditorSceneManager.OpenScene(Application.dataPath + "/Scenes/UIEditor.unity");
    }
    [MenuItem("Custom/GoToTestEditor")]
    public static void GoToTestEditor()
    {
        EditorSceneManager.OpenScene(Application.dataPath + "/Scenes/TestEditor.unity");
    }


    [MenuItem("Custom/ConfigToResources")]
    public static void ConfigToResources()
    {
        var srcPath = Application.dataPath + "/../Config/";
        var dstPath = Application.dataPath + "/Resources/Config/";
        Directory.Delete(dstPath, true);
        Directory.CreateDirectory(dstPath);
        
        foreach(var filePath in Directory.GetFiles(srcPath))
        {
            var fileName = filePath.Substring(filePath.LastIndexOf('/') + 1);
            File.Copy(filePath, dstPath + fileName + ".bytes", true);
        }
        AssetDatabase.Refresh();
        Debug.Log("文件复制完成");
    }
}
